public class Test {
}
class Solution1 {
    public void rotate(int[] nums, int k) {
        if(k > nums.length) {
            k = k % nums.length;
        }
        for (int i = 0; i < k; i++) {
            int n = nums[nums.length - 1];
            for (int j = nums.length - 2; j >=0 ; j--) {
                nums[j+1] = nums[j];
            }
            nums[0] = n;
        }
    }
}
class Solution {
    public void rotate(int[] nums, int k) {
        if(k > nums.length) {
            k = k % nums.length;
        }
        int[] arr = new int[nums.length];
        for (int i = k; i < nums.length; i++) {
            arr[i] = nums[i-k];
        }
        for (int i = 0; i < k; i++) {
            arr[i] = nums[nums.length - k + i];
        }
        for (int i = 0; i < nums.length; i++) {
            nums[i] = arr[i];
        }
    }
}